package com.hou.hpsj_springboot.service.Impl;

import com.hou.hpsj_springboot.entity.Users;
import com.hou.hpsj_springboot.entity.Videos;
import com.hou.hpsj_springboot.mapper.FriendListMapper;
import com.hou.hpsj_springboot.mapper.VideosMapper;
import com.hou.hpsj_springboot.service.FriendListService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class FriendListImpl implements FriendListService {
    @Resource
    private FriendListMapper friendListMapper;
    @Resource
    private VideosMapper videosMapper;
    @Override
    public List<Users> getFriendList(String email) {
        return friendListMapper.selectFriendList(email);
    }

    @Override
    public Users selectFriendPageById(long userId) {
        Users users = friendListMapper.selectFriendPageById(userId);
        List<Videos> videos = videosMapper.selectVideoByUserId(userId);
        users.setVideosList(videos);
        return users;
    }
}
